{% load static %}
{% load utils %}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>编辑管理员</title>
<link rel="stylesheet" href="{% static '/public/css/ui.css' %}">
<link rel="stylesheet" href="{% static '/public/admin/css/layout.css' %}">
<script src="{% static '/public/js/jquery.js' %}"></script>
<script src="{% static '/public/js/ui.js' %}"></script>
</head>
<body>

<body class="bg_white">
<div class="border_iframe">
    <form class="ui-form" method="post">
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">用户名：</label>
            <div class="ui-col-9">
                <input type="text" name="adminname" class="ui-form-ip" value="{{adminname}}" disabled>
            </div>
        </div>
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">密码：</label>
            <div class="ui-col-9">
                <input type="text" name="adminpass" class="ui-form-ip" maxlength="16" ><span class="input-tips">不修改请留空</span>
            </div>
        </div>
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">昵称：</label>
            <div class="ui-col-9">
                <input type="text" name="penname" class="ui-form-ip" value="{{penname}}">
            </div>
        </div>
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">部门选择：</label>
            <div class="ui-col-9">
                <select name="pid" class="ui-form-ip">
                    <option value="0">超级管理员</option>
                    {% for_rs top="8" table="manager_adminpart" where="1=1" order="ordnum,id" %}
                    <option value="{{ rs.id }}"{% if pid == rs.id %} selected{% endif %}>{{ rs.title }}</option>
                    {% endfor_rs %}
                </select>
            </div>
        </div>
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">状态：</label>
            <div class="ui-col-9 col-right-top">
                <label class="ui-radio">
                    <input type="radio" name="islock" value="1"{% if islock == 1 %} checked{% endif %}><i></i>启用
                </label>
                <label class="ui-radio">
                    <input type="radio" name="islock" value="0"{% if islock == 0 %} checked{% endif %}><i></i>锁定
                </label>
            </div>
        </div>
        <div class="ui-form-group ui-row">
            <label class="ui-col-3 ui-col-form-label">只读模式：</label>
            <div class="ui-col-9 col-right-top">
                <label class="ui-radio"><input type="radio" name="readonly" value="1"{% if readonly == 1 %} checked{% endif %}><i></i>开启</label>
                <label class="ui-radio"><input type="radio" name="readonly" value="0"{% if readonly == 0 %} checked{% endif %}><i></i>关闭</label>
            </div>
        </div>
        <div class="ui-form-group ui-hide">
            {% csrf_token %}
            <button type="submit" id="wmcms-submit">保存</button>
        </div>
    </form>
    <!---->
</div>

<script>
$(function()
{
	var backurl=window.parent.location;
	$(".ui-form").form(
	{
		type:2,
		align:'bottom-center',
		result:function(form)
		{
			$.ajax(
			{
				type:'post',
				cache:false,
				dataType:'json',
				url:'{% url "manager:admin_edit" adminid %}',
				data:$(form).serialize(),
				error:function(e){alert(e.responseText);},
				success:function(d)
				{
					if(d.state=='success')
					{
						wmcms.success(d.msg);
						setTimeout(function(){parent.location.href=backurl;},1000);
					}
					else
					{
						wmcms.error(d.msg);
					}  
				}
			});
		}
	});
})
</script>
</body>
</html>